import datetime
from python_baway.common.xcommon import sep

sep('datetime')
xnowdt = datetime.datetime.now()
print(xnowdt.isoformat())

sep('time')
xtime = datetime.time(xnowdt.hour, xnowdt.minute, xnowdt.second, xnowdt.microsecond)
print(xtime.isoformat())
xnow_time = datetime.datetime.now().time()
print(xnow_time.isoformat())

sep('date')
xdate = datetime.date(xnowdt.year, xnowdt.month, xnowdt.day)
print(xdate.isoformat())
xtoday_date = datetime.date.today()
print(xtoday_date.isoformat())

sep('datetime utc')
xnowdt_utc = datetime.datetime.utcnow()
xnowdt_utc = xnowdt_utc.replace(tzinfo=datetime.timezone.utc)
print(xnowdt_utc.isoformat())

sep('datetime utc => time')
xtime_utc = xnowdt_utc.time()  # Return time object with same hour, minute, second, microsecond and fold. tzinfo is None.
print(xtime_utc.isoformat())

sep('datetime utc => date')
xdate_utc = xnowdt_utc.date()
print(xdate_utc.isoformat())

sep('datetime utc => time with tz')
xtime_utc = xnowdt_utc.timetz()  # Return time object with same hour, minute, second, microsecond, fold, and tzinfo attributes.
print(xtime_utc.isoformat())
